 <extend name="Public/base" />

<block name="body">
 <div class="main-title">
        <h2>定制价格--{$goods.name}</h2>
    </div>
    <form action="{:U('price')}" method="post" class="form-horizontal">   
        <div class="form-item">
            <label class="item-label">统一输入价格</label>
            <div class="controls">
                <div class="controls">
                    <input type="text" class="text input-large " id="tprice" value="" placeholder="市场价格">
                </div>
                <div class="controls">
                    <input type="text" class="text input-large " id="mprice" value="" placeholder="商城价格">
                </div>
                <div class="controls">
                    <input type="text" class="text input-large " id="num" value="" placeholder="库存量">
                </div>
					<input type="hidden" name="gid" value="{$goods.id}">
            </div>

			<volist name='res' id='v'>
               <label class="item-label">{$v['value']}</label>
            <div class="controls">
                <div class="controls">
                    <input type="text" class="text input-large " name="tprice[]" value="" placeholder="市场价格">
                </div>
                <div class="controls">
                    <input type="text" class="text input-large " name="mprice[]" value="" placeholder="商城价格">
                </div>
                <div class="controls">
                    <input type="text" class="text input-large " name="num[]" value="" placeholder="库存量">
                </div>
					<input type="hidden" name="gid" value="{$goods.id}">
            </div>
			</volist>
            <volist name="attrvalid" id="va">
            <input type="hidden" name="attrvalid[]" value="{$va}">
            </volist>
        </div>
        <p class="item-label" style="color: red">*已定制价格可在价格列表修改或删除*</p>
        <div class="form-item">
            <button class="btn submit-btn " id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
    //搜索功能
    $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
        window.location.href = url;
    });
    //回车搜索
    $(".search-input").keyup(function(e){
        if(e.keyCode === 13){
            $("#search").click();
            return false;
        }
    });
    //导航高亮
    highlight_subnav('{:U('Price/index')}');

    $(function(){
            $("#num").keyup(function(){
                var val = $("#num").val();
                $("input[name='num[]']").val(val);
            });
            $("#mprice").keyup(function(){
                var val = $("#mprice").val();
                $("input[name='mprice[]']").val(val);
            });
            $("#tprice").keyup(function(){
                var val = $("#tprice").val(); 
                $("input[name='tprice[]']").val(val);
            });
        })



    </script>
</block>